from api_py.enums.cookie import Cookie
from api_py.generate_case.template import template_case
from api_py.utils.file_sys import write_json


id = {"value": "ff80818184cdbf5e0184dcfffca002d5", "description": "合法排班id"}

cookies = [
    {"value": Cookie.ADMIN_COOKIE.value, "description": "管理员登录"},
    {"value": Cookie.SUPERVISOR_COOKIE.value, "description": "督导登录"},
    {"value": Cookie.COUNSELOR_COOKIE.value, "description": "咨询师登录"},
    {"value": Cookie.WEIXIN_COOKIE.value, "description": "微信访客登录"},
    {"value": Cookie.NULL_COOKIE.value, "description": "未登录"},
    {"value": Cookie.ERROR_COOKIE.value, "description": "其他Cookie"},
]


def case25_arrange(api_type):
    json_result = {}
    i = 0

    for cookie in cookies:
        case = template_case()
        request = case["request"]
        # 设置url参数
        request["params"]["id"] = id
        # 设置请求头cookie
        request["headers"]["Cookie"] = cookie

        json_result[i] = case
        i += 1

    write_json(api_type.value[0]["file_name"], json_result)